package com.eims.sls_app.dialog;

import com.eims.sls_app.utils.App;
import com.eims.sls_app.utils.AppTools;
import com.listener.OnHallDanguanPaySureListener;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import bls.juejin.cn.R;

public class HallDanguanPaySureDialog extends Dialog implements android.view.View.OnClickListener {

	private Button btnPayOk;
	private Context context;
	private TextView tvTotalMoney, tvMyMoney;
	private View view;
	private String totalMoney;
	private OnHallDanguanPaySureListener listener;

	public HallDanguanPaySureDialog(Context context, OnHallDanguanPaySureListener listener, String totalMoney) {
		// TODO Auto-generated constructor stub
		super(context, R.style.Pay_test_dialog);
		this.context = context;

		this.listener = listener;
		this.totalMoney = totalMoney;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hall_danfuan_pay_sure_dialog);
		tvMyMoney = (TextView) findViewById(R.id.tv_myMoney);
		tvTotalMoney =(TextView) findViewById(R.id.tv_totalMoney);
		btnPayOk = (Button) findViewById(R.id.btn_pay_ok);
		btnPayOk.setEnabled(true);
		btnPayOk.setOnClickListener(this);
		tvTotalMoney.setText("订单金额："+totalMoney+"元");
		tvMyMoney.setText("可用余额："+(Double.parseDouble(App.user.getBalance())+Double.parseDouble(App.user.getHandselAmount()))+"元");
	}

	@Override
	public void show() {
		super.show();
	}

	@Override
	public void onBackPressed() {

	}

	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {

		case R.id.btn_pay_ok:
			btnPayOk.setEnabled(false);
			listener.onSureClick();
			dismiss();
			break;

		default:
			break;
		}
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		dismiss();
		return super.onKeyDown(keyCode, event);
	}

}
